//
//  UIImage+mirror.m
//  InitDemo
//
//  Created by 江伟 on 2018/8/16.
//  Copyright © 2018年 weiJiang. All rights reserved.
//

#import "UIImage+mirror.h"

@implementation UIImage (mirror)
+ (UIImage *)CircleImage:(NSString *)fileName {
    return [[[self alloc] initWithName:fileName] circleImage];
}
/// 裁剪一个UIImage
- (UIImage *)circleImage {
    CGFloat shotest = MIN(self.size.width, self.size.height);
    CGRect outputRect = CGRectMake(0, 0, shotest, shotest);
    UIGraphicsBeginImageContextWithOptions(outputRect.size, NO, 0);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextAddEllipseInRect(context, outputRect);
    CGContextClip(context);
    [self drawInRect:CGRectMake((shotest - self.size.width)/2, (shotest - self.size.height)/2, self.size.width, self.size.height)];
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return img;
}

- (UIImage *)Img_X_Mirror:(UIImage *)img {
//    UIBezierPath
    return [UIImage new];
}

@end
